import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 * @date 2023/9/4 15:58
 * 校验 url 和 title
 */
public class Main03 {

    public static void main(String[] args) {
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--remote-allow-origins=*");
        WebDriver webDriver = new ChromeDriver(options);
        webDriver.get("https://www.baidu.com/");
        String url = webDriver.getCurrentUrl();
        String title = webDriver.getTitle();
        if (url.equals("https://www.baidu.com/") && title.equals("百度一下，你就知道")) {
            System.out.println("url = " + url);
            System.out.println("title = " + title);
            System.out.println("测试通过!");
        } else {
            System.out.println("测试不通过!");
        }
    }
}
